package com.behome.socket_proxy;

import com.behome.socket_proxy.netty_D.Constants;
import com.behome.socket_proxy.netty_D.server.StandardDNettyServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


@Component
@Slf4j
public class CommandLineRunnerImpl implements CommandLineRunner {
    @Value("${socket.port}")
    private int PORT;
    @Value("${socket.proxy1}")
    private String proxy1;
    @Value("${socket.proxy2}")
    private String proxy2;
//    @Resource
//    StandardDNettyServer standardDNettyServer;

    @Override
    public void run(String... args) {
        Constants.port = this.PORT;
        Constants.proxy1 = this.proxy1;
        Constants.proxy2 = this.proxy2;
        try {
            StandardDNettyServer.getInstance().start();
        } catch (Exception e) {
            e.printStackTrace();
        }
        new timeTask().start();
    }

}
